<?php defined('SYSPATH') or die('No direct script access.');
require ('application/classes/dao/base.php');

require('application/classes/dao/Utils.php');
class Controller_pageconfigm extends Controller {
	public function action_list(){
		echo View::factory('manager/pageconfig');
	}
	public function action_detail(){
		 if(!isset($parm['id'])||$parm['id']==""){
            die("配置id不能为空");
        }
	}

	public function action_getList(){
		$parm = get($this->request);
		if(!isset($parm['page']) ||($parm['page'])==""){
			echo "page不能为空";
			exit;
		}
		if(!isset($parm['rows']) ||($parm['rows'])==""){
			echo "rows能为空";
			exit;
		}
		$result = rpcCall("pageconfig.getList",$parm);
        echo json_encode($result);
	}

	public function action_action_add(){
		echo View::factory('manager/addPageconfig');
	}

	public function action_addPageconfig(){
		$parm = post($this->request);
//		print_r($parm);

		if($parm['type']=='底部模块1'||$parm['type']=='底部模块2'||$parm['type']=='底部模块3'||$parm['type']=='底部模块4'){
			echo 111;
			$parm["count"]=4;

		}
		if($parm['type']=='底部联系方式'){
			$parm["count"]=1;
			$parm['content']=$parm['contact'];

		}
		if($parm['type']=='配送时间'){
			$parm["count"]=1;
			$parm['content']=$parm['time'];

		}
		if($parm['type']=='配送时间说明'){
			$parm["count"]=1;
			$parm['content']=$parm['timedesc'];

		}
		if($parm['type']=='二维码'){
			$parm["count"]=1;
			$parm['content']=str_replace("\"", "", $parm['uploadPhone']);
			 moveUploadFile($parm['content']);
		}
		rpcCall('pageconfig.insert',$parm);
		echo "<script>window.location.href='".Url::base()."index.php/pageconfigm/list'</script>";
	}

}